function PaladinG1zStar2() -- protection

	if not ThrottleFrame then _ThrottleFrame() end

	if GetShapeshiftForm() ~= 3 then CastShapeshiftForm(3) return end -- seal of insight

	if ccrValidTarget() and ccrPIIC() then

		if ccRS.G1zStarTaunt then TauntTrainer() end
		if ccRS.G1zStarInterrupt then InterruptTrainer() end
		
		if _Stun and SCA(853) then -- hammer of justice
			ccrCastAttack(853)
			_Stun = false
			return
		end

		if _BlindingLight and SIR(115750) then
			ccrCast(115750)
			_BlindingLight = false
			return
		end
		if _DivineShield and SIR(642) then
			ccrCast(642)
			_DivineShield = false
			return
		end
		
		if ccRS.G1zStarProtectionPaladinDP and SIR(498) then ccrCast(498) end -- divine protection

		local sotr, hp = SCA(53600), ccrHolyPower()
		if ccrPHB(90174) and hp >= 2 and sotr then ccrCastAttack(53600) end -- divine purpose sotr dump

		if ccrPlayerHasTalent(53376) and ccrPHB(31884) and SCA(20271) then -- sanctified wrath, avenging wrath, judgment check
			if sotr and hp == 5 then ccrCastAttack(53600) end -- sotr dump
			ccrCastAttack(20271)
			return
		end
		if ccrPlayerHasTalent(53376) and SpellCDDuration(20271) > 0 and SpellCDDuration(20271) <= 0.5 then return end -- sanctified wrath wait for judgment

		if SCA(35395) then -- crusader strike
			if sotr and hp == 5 then ccrCastAttack(53600) end -- sotr dump
			if GTargetCount(8) > 1 and (ccRS.Auto_AoE or ccRS.Manual_AoE) then ccrCastAttack(53595) return end -- hammer of the righteous check aoe
			ccrCastAttack(35395)
			return
		end
		if SpellCDDuration(35395) > 0 and SpellCDDuration(35395) <= 0.5 then return end -- crusader strike wait

		if SCA(20271) then -- judgment
			if sotr and hp == 5 then ccrCastAttack(53600) end -- sotr dump
			ccrCastAttack(20271)
			return
		end
		if SpellCDDuration(20271) > 0 and SpellCDDuration(20271) <= 0.5 and (SpellCDDuration(35395)-SpellCDDuration(20271)) >= 0.5 then return end -- judgment wait

		if SCA(31935) then -- avenger's shield
			if sotr and hp == 5 and ccrPHB(85416) then ccrCastAttack(53600) end -- sotr grand crusader dump
			ccrCastAttack(31935)
			return
		end
		
		if ccrPlayerHasTalent(20925) and (ccrPHBR(20925, 5) or not ccrPHB(20925)) then ccrCast(20925) return end -- sacred shield
		
		if SIR(119072) and GPlayerCount(10) > 0 then ccrCastAttack(119072) return end -- holy wrath
		
		if ccrPlayerHasTalent(114157) and SCA(114157) and not ccrTargetHasDebuff(145065) and not ccrTargetHasDebuff(145171) then ccrCastAttack(114157) return end -- execution sentence not touch of y'shaarg + empowered
		if ccrPlayerHasTalent(114158) and SIR(114158) and GPlayerCount(10) > 0 then GCast(Player.GUID, 114158) return end -- light's hammer dropped on you based on # around you

		if SCA(24275) then ccrCastAttack(24275) return end -- hammer of wrath

		if SIR(26573) and not ccrPlayerHasGlyph(54928) and GPlayerCount(8) > 0 then ccrCast(26573) return end -- consecration non glyphed
		if SIR(26573) and ccrPlayerHasGlyph(54928) then GCast(Target.GUID, 26573) return end -- consecration at your target glyphed
		
		if ccrPlayerHasTalent(114165) and SIR(114165) then
			if (ccRS.Auto_AoE or ccRS.Manual_AoE) and GPlayerCount(15) > 1 then ccrCast(114165, "player") return end -- holy prism aoe
			ccrCastAttack(114165) -- holy prism single target
			return
		end
	end
end

function PaladinG1zStar3()
	
	if not ThrottleFrame then _ThrottleFrame() end

	if ccrPIIC() then

		if ccrValidTarget() and _Stun and SCA(853) then -- stun
			ccrCastAttack(853)
			_Stun = false
		end

		if _BlindingLight and SIR(115750) then
			ccrCast(115750)
			_BlindingLight = false
			return
		end
		if _DivineShield and SIR(642) then
			ccrCast(642)
			_DivineShield = false
			return
		end

		if (not ccrPHB(84963) or ccrPHBR(84963, 2)) and (ccrHolyPower() >= 3 or ccrPHB(90174)) then -- inquisition
			ccrCast(84963)
			return
		end

		glovescd, glovesdur, glovesenable = GetInventoryItemCooldown("Player", 10)
	end

	if ccrPIIC() and ccrValidTarget() then
		
		if ccRS.G1zStarInterrupt then InterruptTrainer() end

		-- cooldowns
		if ccrTargetIsBoss() and SIR(31884) and useCDS and ccrPHB(84963) then
			ccrCast(31884)
			return
		end
		if ccrTargetIsBoss() and SIR(86698) and useCDS and ccrPHB(84963) then
			ccrCast(86698)
			return
		end
		if ccrPlayerHasTalent(105809) and useCDS and ccrPHB(84963) and ccrHolyPower() <= 2 then
			ccrCast(105809)
			return
		end
		if useCDS and ccrPHB(84963) and (not ccrPHB(86700) or ccrPHBS(86700, 12)) and glovesenable == 1 and glovescd == 0 then
			UseInventoryItem(10)
			return
		end
		if useCDS and UnitRace("Player") == "Orc" and SIR(20572) then ccrCast(20572)  return end -- blood fury 
		if useCDS and UnitRace("Player") == "Troll" and SIR(26297) then ccrCast(26297)  return end -- berserking 
		-- cooldowns

		if ccrPlayerHasTalent(114157) and SCA(114157) and ccrPHB(84963) and (ccrPHBS(86700, 12) or not ccrPHB(86698)) and not ccrTargetHasDebuff(145065) and not ccrTargetHasDebuff(145171) then
			ccrCastAttack(114157)
			return
		end
		if ccrPlayerHasTalent(114158) and SIR(114158) and GPlayerCount(10) > 0 and ccrPHB(84963) and (not ccrPHB(86700) or ccrPHBS(86700, 12)) then
			GCast(Player.GUID, 114158)
			return
		end
		if GPlayerCount(8) > 1 and (ccRS.Auto_AoE or ccRS.Manual_AoE) and (ccrHolyPower() == 5 or ccrPHB(90174) or (ccrPHB(105809) and ccrHolyPower() >= 3)) then
			ccrCast(53385)
			return
		end
		if ccrPHB(144595) and ccrHolyPower() == 5 then 
			if GPlayerCount(8) > 0 then
				ccrCast(53385)
				return
			elseif Target:GetDistance() <= (8+Target:GetCombatReach()) then
				ccrCast(53385)
				return
			end
		end
		if SCA(85256) and (ccrHolyPower() == 5 or (ccrPHB(105809) and ccrHolyPower() >= 3)) then
			ccrCastAttack(85256)
			return
		end
		if SCA(85256) and ccrPHB(90174) and ccrPHBR(90174, 4) then
			ccrCastAttack(85256)
			return
		end
		if SCA(24275) then
			ccrCastAttack(24275)
			return
		end
		if SpellCDDuration(24275) > 0 and SpellCDDuration(24275) <= 0.2 then return end 
		if SIR(53385) and ccrPHB(144595) and ccrPHB(31884) then
			if GPlayerCount(8) > 0 then ccrCast(53385) return
				elseif Target:GetDistance() <= (8+Target:GetCombatReach()) then ccrCast(53385) return end
		end
		if SCA(85256) and ccrPHB(31884) then
			ccrCastAttack(85256)
			return
		end
		if SCA(35395) then
			if (ccRS.Auto_AoE or ccRS.Manual_AoE) and GTargetCount(8) > 3 then
				ccrCastAttack(53595)
				return
			end
			ccrCastAttack(35395)
			return
		end
		if SpellCDDuration(35395) > 0 and SpellCDDuration(35395) <= 0.2 then return end 
		if SCA(20271) then
			ccrCastAttack(20271)
			return
		end
		if SpellCDDuration(20271) > 0 and SpellCDDuration(20271) <= 0.2 then return end 
		if SIR(53385) and ccrPHB(144595) then
			if GPlayerCount(8) > 0 then ccrCast(53385) return
				elseif Target:GetDistance() <= 8+Target:GetCombatReach() then ccrCast(53385) return end
		end
		if SCA(85256) and ccrPHB(90174) then
			ccrCastAttack(85256)
			return
		end
		
		if SCA(122032) then
			ccrCastAttack(122032)
			return
		end
		if SpellCDDuration(122032) > 0 and SpellCDDuration(122032) <= 0.2 then return end 

		if (ccRS.Auto_AoE or ccRS.Manual_AoE) and SIR(53385) and GPlayerCount(8) > 1 and ccrPHB(84963) and not ccrPHBR(84963, 4) then -- and ccrPHB(84963)
			ccrCast(53385)
			return
		end
		if SCA(85256) and ccrPHB(84963) and not ccrPHBR(84963, 4) then -- and ccrPHB(84963)
			ccrCastAttack(85256)
			return
		end
		if ccrPlayerHasTalent(114165) and (ccRS.Auto_AoE or ccRS.Manual_AoE) and SIR(114165) and GPlayerCount(15) > 1 then
			ccrCast(114165, "player")
			return
		end
		if ccrPlayerHasTalent(114165) and SIR(114165) then
			ccrCastAttack(114165)
			return
		end
	end -- retribution
end